package com.example.designmode.strategyPattern;

import java.math.BigDecimal;

//满减打折同时活动 先满减后打折
public class FullSubtractFormLoad extends Strategy{

    //单价
    private double unitPrice;
    //数量
    private double number;
    //满足满多少金额
    private double full;
    //减多少金额
    private double subtract;
    //折扣
    private double discount;

    public FullSubtractFormLoad(double unitPrice, double number, double full, double subtract, double discount) {
        this.unitPrice = unitPrice;
        this.number = number;
        this.full = full;
        this.subtract = subtract;
        this.discount = discount;
    }


    @Override
    double AlgorithmInterface() {
        double fullMoney = new FullSubtract(unitPrice, number, full, subtract).AlgorithmInterface();
        return new BigDecimal(fullMoney).multiply(new BigDecimal(discount)).doubleValue();
    }
}
